import Cookies from 'js-cookie'

const TokenKey = 'x_l_admin_token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function getRefreshToken() {
  return Cookies.get(TokenKey + '_refresh')
}

export function getTokenExpires() {
  return Cookies.get(TokenKey + '_refresh')
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function setRefreshToken(token) {
  return Cookies.set(TokenKey + '_refresh', token)
}

export function setTokenExpires(token) {
  return Cookies.set(TokenKey + '_expires', token)
}

export function removeToken() {
  Cookies.remove(TokenKey + '_refresh')
  Cookies.remove(TokenKey + '_expires')
  return Cookies.remove(TokenKey)
}
